﻿import QtQuick 2.0
import "../components"

Item {
    property int bs;
    property int bs2;
    property var type;
    anchors.fill: parent
    Connections{  // qmlre
        target: MACO
        onShwdd:{
            shw.setText(temp);
        }
    }
    Row{        // 第一行 ==========================
        spacing: 15*dp
        LineEditor{
            id : cm
            title: "步数"
            textWidth: 38*dp
            editWidth: 160*dp
            intflag: true
            onTextChanged: {
                var inputValue = parseInt(getText());
                if (!isNaN(inputValue)) {
                    bs = inputValue;
                }
            }
            Keys.onTabPressed: {
                focus = false
                hcv.focus = true
            }
        }
        PushButton{
            title: "开仓门"
            defaultMode1: true
            onReleased: {
                MACO.cmk(bs)
            }
        }
        PushButton{
            title: "关仓门"
            defaultMode2: true
            onReleased: {
                MACO.cmg(bs)
            }
        }
    }

    Row{            // 第二行 ======================
        y: 60*dp
        spacing: 15*dp
        LineEditor{
            id:shw
            title: "温度(°C)"
            textWidth: 62*dp
        }
        PushButton{
            title: "获取"
            defaultMode1: true
            onReleased: {
                MACO.shwd()
            }
        }
    }


    Rectangle{      // 分割线 ======================
        width: parent.width
        height: 1
        y: 120*dp
        color: "#EEEEEE"
    }

    Row{            // 第三行 ======================
        y: 140*dp
        spacing: 15*dp
        LineEditor{
            id: hcv
            title: "耗材类型"
            textWidth: 68*dp
            editWidth: 200*dp
            onTextChanged: {
                hclx("八连排")
            }
            Keys.onTabPressed: {
                focus = false
                bsv.focus = true
            }
        }
        LineEditor{
            id: bsv
            title: "步数"
            textWidth: 38*dp
            editWidth: 140*dp
            intflag: true
            onTextChanged: {
                var inputValue = parseInt(getText());
                if (!isNaN(inputValue)) {
                    bs2 = inputValue;
                }
            }
            Keys.onTabPressed: {
                focus = false
                cm.focus = true
            }
        }
        PushButton{
            title: "电机上升"
            defaultMode1: true
            onReleased: {
                MACO.djss(bs2)
            }
        }
        PushButton{
            title: "电机复位"
            defaultMode1: true
            onReleased: {
                MACO.djfw()
            }
        }
        PushButton{
            title: "耗材自动校准"
            defaultMode1: true
        }
    }


}
